<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
   pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="support.*,java.util.*"%>
<html>
<head>
<link rel="stylesheet" type="text/css" href="layout.css" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Degree Form</title>
</head>
<body>
   <%
      //i can use this variable to keep track of degrees 0 is to setup student
      student applicant = (student) session.getAttribute("applicant");

      Vector tuple;

      if ((Integer) session.getAttribute("count") == 0) {
         applicant.addy.setStreet((String) request.getParameter("street"));
         applicant.addy.setCity((String) request.getParameter("city"));
         applicant.addy.setZip(Integer.parseInt((String) request
               .getParameter("zipCode")));
         applicant.addy.setCountryCode((String) request
               .getParameter("teleCode"));
         applicant.addy.setAreaCode(Integer.parseInt((String) request
               .getParameter("areaCode")));
         applicant.addy.setPhoneNumber((String) request
               .getParameter("phoneNumber"));
         applicant.addy.setState((String) request.getParameter("state"));

      }
   %>
   <h1>Degree - Location</h1>
   <hr>
   <p><b>Please Choose where you obtained your degree:</b></p>

   <table border="1">
      <%
         int size = applicant.getUniversityVector().size(), rows, cell1, cell2, cell3;

         if (applicant.getUniversityVector().size() % 3 == 0)
            rows = (int) (size / 3);
         else
            rows = (int) (size / 3) + 1;

         for (int i = 0; i < rows; i++) {
            cell1 = i;
            cell2 = i + rows;
            cell3 = i + 2 * rows;
            tuple = (Vector) applicant.getUniversityVector().get(cell1);
      %>
      <tr>
         <td><a href="degreeUniv.jsp?stateCon=<%=cell1%>"><%=tuple.get(0)%></a></td>
         <%
            if (cell2 < size) {
                  tuple = (Vector) applicant.getUniversityVector().get(cell2);
         %>
         <td><a href="degreeUniv.jsp?stateCon=<%=cell2%>"><%=tuple.get(0)%></a></td>
         <%
            }
               if (cell3 < size) {
                  tuple = (Vector) applicant.getUniversityVector().get(cell3);
         %>
         <td><a href="degreeUniv.jsp?stateCon=<%=cell3%>"><%=tuple.get(0)%></a></td>
         <%
            }
         %>
      </tr>
      <%
         }
      %>
   </table>



</body>
</html>